package com.guyj.lib_business.managers;

import android.content.Context;

import com.adorkable.iosdialog.AlertDialog;
import com.adorkable.iosdialog.IDialogClickListener;

/**
 * Created by guyj on 2019/7/23.
 * 描述: 统一使用alertDialog的地方
 */
public class DialogManager {

	private DialogManager() {
	}

	public static DialogManager getInstance() {
		return SingletonHolder.sInstance;
	}

	//静态内部类
	private static class SingletonHolder {
		private static final DialogManager sInstance = new DialogManager();
	}

	private AlertDialog mAlertDialog;

	public void showAAADialog(Context context, IDialogClickListener listener) {
		if (mAlertDialog != null && mAlertDialog.isShowing()) {
			mAlertDialog.dismiss();
		}
		mAlertDialog = new AlertDialog(context).builder().setCancelable(true).setTitle("标题").setContent("文本内容").setLeftButton("取消", 14, 0, 0, listener).setRightButton("确定", 14, 0, 0, listener);
		if (!mAlertDialog.isShowing()) {
			mAlertDialog.show();
		}
	}
}
